package com.wcw.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.gson.Gson;
import com.wcw.entity.Book;
import com.wcw.mapper.BookMapper;

@Service
public class BookService {

	@Autowired
	private BookMapper bookMapper;
	
	public void selectBookById(Integer id) {
		Book bookMap = bookMapper.selectBookDetail(id);
		System.out.println(new Gson().toJson(bookMap));
	}
	
	public void selectBookById2(Integer id) {
		Book bookMap = bookMapper.selectBookDetail2(id);
		System.out.println(new Gson().toJson(bookMap));
	}
	
	@Transactional(readOnly = true)
	public void updateBookById(Book book) {
		
		bookMapper.updateById(book);
	}
}
